package com.henry.web;

import com.henry.dao.entity.SysTplCode;
import com.henry.service.SysTplCodeService;
import com.henry.web.vo.Response;
import com.henry.web.vo.SysTplCodeRequestBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;


/**
 * 
 * 
 * @author zhenggui.wu
 * @email 237891668@qq.com
 * @date 2017-05-20 18:24:30
 */
@RestController
@RequestMapping("sys")
public class SysTplCodeController {

    @Autowired
    private SysTplCodeService sysTplCodeService;

    /**
     * 跳转list列表页面
     */
    @RequestMapping(value = "/sysTemplateList.show", method = RequestMethod.GET)
    public ModelAndView sysTemplateList(SysTplCodeRequestBean sysTplCodeRequestBean) {
        List<SysTplCode> sysTemplateList = sysTplCodeService.findAllSysTplCode(sysTplCodeRequestBean);
        ModelAndView view=new ModelAndView("sys/sysTemplateList");
        view.addObject("sysTemplateList",sysTemplateList);
        return view;
    }

    /**
     * 跳转新增页面
     */
    @RequestMapping(value = "/add.show", method = RequestMethod.GET)
    public String addPage() {
        return "sysTemplate/sysTemplate_add";
    }


    /**
     * 保存
     */
    @RequestMapping(value = "/save.do", method = RequestMethod.POST)
    public Response save(SysTplCodeRequestBean sysTplCodeRequestBean){
        return sysTplCodeService.saveSysTplCode(sysTplCodeRequestBean);
    }

    /**
     * 修改
     */
    @RequestMapping(value = "/update.do", method = RequestMethod.POST)
    public Response update(SysTplCodeRequestBean sysTplCodeRequestBean){
        return sysTplCodeService.updateSysTplCode(sysTplCodeRequestBean);
    }
    /**
     * 修改
     */
    @RequestMapping(value = "/yulan.do", method = RequestMethod.POST)
    public Response yulan(SysTplCodeRequestBean sysTplCodeRequestBean){
        return sysTplCodeService.yuLan(sysTplCodeRequestBean);
    }

    /**
     * 删除
     */
//    @RequestMapping(value = "/delete.do/{id}", method = RequestMethod.POST)
//    public String delete(@PathVariable("id") Integer id){
//        sysTplCodeService.deleteSysTplCode(id);
//        return "sysTemplate/sysTemplateList";
//    }
}
